package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.StrategyCatalog;
import cn.wolfcode.wolf2w.service.IDestinationService;
import cn.wolfcode.wolf2w.service.IRegionService;
import cn.wolfcode.wolf2w.service.IStrategyCatalogService;
import cn.wolfcode.wolf2w.service.IStrategyService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("destinations")
public class DestinationsController {


    @Autowired
    private IDestinationService destinationService;

    @Autowired
    private IRegionService regionService;

    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;

    @RequestMapping("/hotRegion")
    public Object hotRegion() {
        return JsonResult.success(regionService.queryHotRegion());
    }

    @RequestMapping("/search")
    public Object search(String regionId) {
        return JsonResult.success(destinationService.queryDestByRegionIdForApi(regionId));
    }

    @RequestMapping("/toasts")
    public Object toasts(String destId) {
        return JsonResult.success(destinationService.queryToasts(destId));
    }


    @RequestMapping("/detail")
    public Object detail(String id) {
        return JsonResult.success(destinationService.queryDestByRegionId(id));
    }

    @RequestMapping("/catalogs")
    public Object catalogs(String destId) {
        return JsonResult.success(strategyCatalogService.queryCatalogByDestId(destId));
    }

    @RequestMapping("/strategies/viewnumTop3")
    public Object strategiesviewnumTop3(String destId) {
        return JsonResult.success(strategyService.queryViewnumTop3(destId));
    }


}
